#include"gui_timer.h"
#include"gui.h"
#include"gui_spirit.h"
#include<stdio.h>
#include<stddef.h>
#include<sys/list.h>

gui_timer_t *gui_timer_create(uint32_t interval,gui_timer_callback_t callback,gui_timer_callback_t calldata)
{
    gui_timer_t *timer=malloc(sizeof(gui_timer_t));
    if(!timer)
        return NULL;
    timer->interval=interval;
    timer->callback=callback;
    timer->calldata=calldata;
    list_init(&timer->list);
    return timer;
}

int gui_timer_destroy(gui_timer_t *timer)
{
    if(!timer)
        return -1;
    list_del(&timer->list);
    free(timer);
    return 0;
}

